<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">

body { font-family: courier; font-size: 12; }

.code  { font-size: 9; color: #444444; display: none; margin-left: 20px; }
.py_c_api  { color: red; }
.py_macro_api  { color: #FF7000; }
.pyx_c_api  { color: #FF3000; }
.pyx_macro_api  { color: #FF7000; }
.refnanny  { color: #FFA000; }

.error_goto  { color: #FFA000; }

.tag  {  }

.coerce  { color: #008000; border: 1px dotted #008000 }

.py_attr { color: #FF0000; font-weight: bold; }
.c_attr  { color: #0000FF; }

.py_call { color: #FF0000; font-weight: bold; }
.c_call  { color: #0000FF; }

.line { margin: 0em }

</style>
<script>
function toggleDiv(id) {
    theDiv = document.getElementById(id);
    if (theDiv.style.display == 'none') theDiv.style.display = 'block';
    else theDiv.style.display = 'none';
}
</script>
</head>
        <body>
<p>Generated by Cython 0.12.1 on Tue May  4 15:59:54 2010
<p>Raw output: <a href="cgillespie.c">cgillespie.c</a>
<pre class='line' style='background-color: #FFFF17' onclick='toggleDiv("line1")'> 1: from numpy.random import uniform, multinomial, exponential</pre>
<pre id='line1' class='code' style='background-color: #FFFF17'>
    __pyx_t_1 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__uniform));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__uniform));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__uniform));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__multinomial));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__multinomial));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__multinomial));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__exponential));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__exponential));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__exponential));
  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(((PyObject *)__pyx_n_s_8), ((PyObject *)__pyx_t_1));<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_2, __pyx_n_s__uniform);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__uniform, __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_2, __pyx_n_s__multinomial);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__multinomial, __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_2, __pyx_n_s__exponential);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__exponential, __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;

    __pyx_t_2 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_2));
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_m, __pyx_n_s__Model);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_3 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s____init__);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetAttrString</span>(__pyx_t_3, "__doc__");
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_2, ((PyObject *)__pyx_kp_u_9), __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_m, __pyx_n_s__Model);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_3 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__CR);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetAttrString</span>(__pyx_t_3, "__doc__");
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_2, ((PyObject *)__pyx_kp_u_10), __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line2")'> 2: #from numpy import arange, array, empty,zeros</pre>
<pre id='line2' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF8d' onclick='toggleDiv("line3")'> 3: import numpy as np</pre>
<pre id='line3' class='code' style='background-color: #FFFF8d'>
    __pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(((PyObject *)__pyx_n_s__numpy), 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__np, __pyx_t_2) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line4")'> 4: cimport numpy as np</pre>
<pre id='line4' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF8d' onclick='toggleDiv("line5")'> 5: import time</pre>
<pre id='line5' class='code' style='background-color: #FFFF8d'>
    __pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(((PyObject *)__pyx_n_s__time), 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__time, __pyx_t_2) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFF4f' onclick='toggleDiv("line6")'> 6: from random import random</pre>
<pre id='line6' class='code' style='background-color: #FFFF4f'>
    __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_2));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__random));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__random));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__random));
  __pyx_t_1 = <span class='pyx_c_api'>__Pyx_Import</span>(((PyObject *)__pyx_n_s__random), ((PyObject *)__pyx_t_2));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__random);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__random, __pyx_t_2) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line7")'> 7: </pre>
<pre id='line7' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF6a' onclick='toggleDiv("line8")'> 8: DTYPE = np.double</pre>
<pre id='line8' class='code' style='background-color: #FFFF6a'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__double);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line9")'> 9: ctypedef np.double_t DTYPE_t</pre>
<pre id='line9' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line10")'> 10: ctypedef np.int_t INT_t</pre>
<pre id='line10' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line11")'> 11: </pre>
<pre id='line11' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line12")'> 12: cdef extern from "math.h":</pre>
<pre id='line12' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line13")'> 13:     double log(double)</pre>
<pre id='line13' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFe7' onclick='toggleDiv("line14")'> 14: cdef double clog(double x):</pre>
<pre id='line14' class='code' style='background-color: #FFFFe7'>
static  double __pyx_f_5trunk_3BIP_3SDE_10cgillespie_clog(double __pyx_v_x) {
  double __pyx_r;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("clog");
</pre><pre class='line' style='background-color: #FFFFe7' onclick='toggleDiv("line15")'> 15:     return log(x*x)</pre>
<pre id='line15' class='code' style='background-color: #FFFFe7'>
    __pyx_r = log((__pyx_v_x * __pyx_v_x));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line16")'> 16: </pre>
<pre id='line16' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line17")'> 17: cdef extern from "stdlib.h":</pre>
<pre id='line17' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line18")'> 18:     double RAND_MAX</pre>
<pre id='line18' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line19")'> 19:     double c_libc_random "random"()</pre>
<pre id='line19' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line20")'> 20:     void c_libc_srandom "srandom"(unsigned int seed)</pre>
<pre id='line20' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFe7' onclick='toggleDiv("line21")'> 21: cdef crandom():</pre>
<pre id='line21' class='code' style='background-color: #FFFFe7'>
static  PyObject *__pyx_f_5trunk_3BIP_3SDE_10cgillespie_crandom(void) {
  double __pyx_v_rm;
  PyObject *__pyx_r = NULL;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("crandom");
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line22")'> 22:     cdef double rm = RAND_MAX</pre>
<pre id='line22' class='code' style='background-color: #FFFFff'>
    __pyx_v_rm = RAND_MAX;
</pre><pre class='line' style='background-color: #FFFF62' onclick='toggleDiv("line23")'> 23:     return c_libc_random()/rm</pre>
<pre id='line23' class='code' style='background-color: #FFFF62'>
    <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_1 = random();
  if (unlikely(__pyx_v_rm == 0)) {
    <span class='py_c_api'>PyErr_Format</span>(PyExc_ZeroDivisionError, "float division");
   <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  }
  __pyx_t_2 = <span class='py_c_api'>PyFloat_FromDouble</span>((__pyx_t_1 / __pyx_v_rm));<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.crandom");
  __pyx_r = 0;
  __pyx_L0:;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line24")'> 24: </pre>
<pre id='line24' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line25")'> 25: cdef class Model(object):</pre>
<pre id='line25' class='code' style='background-color: #FFFFff'>
struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model {
  PyObject_HEAD
  struct __pyx_vtabstruct_5trunk_3BIP_3SDE_10cgillespie_Model *__pyx_vtab;
  PyObject *vn;
  PyObject *pv;
  PyObject *inits;
  PyArrayObject *tm;
  PyArrayObject *res;
  PyArrayObject *time;
  PyArrayObject *series;
  PyArrayObject *rates;
  unsigned int pvl;
  unsigned int nvars;
  unsigned int steps;
  PyObject *ts;
};


struct __pyx_vtabstruct_5trunk_3BIP_3SDE_10cgillespie_Model {
  PyObject *(*run)(struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *, int __pyx_skip_dispatch, struct __pyx_opt_args_5trunk_3BIP_3SDE_10cgillespie_5Model_run *__pyx_optional_args);
  int (*GSSA)(struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *, struct __pyx_opt_args_5trunk_3BIP_3SDE_10cgillespie_5Model_GSSA *__pyx_optional_args);
};
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line26")'> 26:     cdef object vn,pv, inits</pre>
<pre id='line26' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line27")'> 27:     cdef np.ndarray tm,res,time,series, rates</pre>
<pre id='line27' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line28")'> 28:     cdef unsigned int pvl,nvars,steps</pre>
<pre id='line28' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line29")'> 29:     cdef object ts</pre>
<pre id='line29' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF24' onclick='toggleDiv("line30")'> 30:     def __init__(self,vnames,rates,inits, tmat,propensity):</pre>
<pre id='line30' class='code' style='background-color: #FFFF24'>
static int __pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5trunk_3BIP_3SDE_10cgillespie_5Model___init__[] = "\n         * vnames: list of strings\n         * rates: list of fixed rate parameters\n         * inits: list of initial values of variables\n         * propensity: list of lambda functions of the form: \n            lambda r,ini: some function of rates ans inits.\n        ";
static int __pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vnames = 0;
  PyObject *__pyx_v_rates = 0;
  PyObject *__pyx_v_inits = 0;
  PyObject *__pyx_v_tmat = 0;
  PyObject *__pyx_v_propensity = 0;
  int __pyx_r;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vnames,&__pyx_n_s__rates,&__pyx_n_s__inits,&__pyx_n_s__tmat,&__pyx_n_s__propensity,0};
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("__init__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds);
    PyObject* values[5] = {0,0,0,0,0};
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  5: values[4] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4);
      case  4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3);
      case  3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2);
      case  2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);
      case  1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  0:
      values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__vnames);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__rates);
      if (likely(values[1])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 1);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
      case  2:
      values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__inits);
      if (likely(values[2])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 2);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
      case  3:
      values[3] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__tmat);
      if (likely(values[3])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 3);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
      case  4:
      values[4] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__propensity);
      if (likely(values[4])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, 4);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args), "__init__") < 0))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
    }
    __pyx_v_vnames = values[0];
    __pyx_v_rates = values[1];
    __pyx_v_inits = values[2];
    __pyx_v_tmat = values[3];
    __pyx_v_propensity = values[4];
  } else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 5) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_vnames = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);
    __pyx_v_rates = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);
    __pyx_v_inits = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2);
    __pyx_v_tmat = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3);
    __pyx_v_propensity = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 4);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__init__", 1, 5, 5, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args));<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
  __pyx_L3_error:;
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.Model.__init__");
  return -1;
  __pyx_L4_argument_unpacking_done:;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line31")'> 31:         '''</pre>
<pre id='line31' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line32")'> 32:          * vnames: list of strings</pre>
<pre id='line32' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line33")'> 33:          * rates: list of fixed rate parameters</pre>
<pre id='line33' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line34")'> 34:          * inits: list of initial values of variables</pre>
<pre id='line34' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line35")'> 35:          * propensity: list of lambda functions of the form:</pre>
<pre id='line35' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line36")'> 36:             lambda r,ini: some function of rates ans inits.</pre>
<pre id='line36' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line37")'> 37:         '''</pre>
<pre id='line37' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line38")'> 38:         self.vn = vnames</pre>
<pre id='line38' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_vnames);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_vnames);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->vn);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->vn);
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->vn = __pyx_v_vnames;
</pre><pre class='line' style='background-color: #FFFF48' onclick='toggleDiv("line39")'> 39:         self.rates = np.array(rates)</pre>
<pre id='line39' class='code' style='background-color: #FFFF48'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__array);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_rates);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_rates);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_rates);
  __pyx_t_3 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_2, __pyx_t_1, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_3, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->rates);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->rates));
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->rates = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
</pre><pre class='line' style='background-color: #FFFF6a' onclick='toggleDiv("line40")'> 40:         self.inits = tuple(inits)</pre>
<pre id='line40' class='code' style='background-color: #FFFF6a'>
    __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_inits);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, __pyx_v_inits);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_inits);
  __pyx_t_1 = <span class='py_c_api'>PyObject_Call</span>(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_3, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->inits);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->inits);
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->inits = __pyx_t_1;
  __pyx_t_1 = 0;
</pre><pre class='line' style='background-color: #FFFFb6' onclick='toggleDiv("line41")'> 41:         self.tm = tmat</pre>
<pre id='line41' class='code' style='background-color: #FFFFb6'>
    if (!(likely(((__pyx_v_tmat) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_v_tmat, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_tmat);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_tmat);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->tm);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->tm));
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->tm = ((PyArrayObject *)__pyx_v_tmat);
</pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line42")'> 42:         self.pv = propensity#[compile(eq,'errmsg','eval') for eq in propensity]</pre>
<pre id='line42' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_propensity);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_propensity);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->pv);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->pv);
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->pv = __pyx_v_propensity;
</pre><pre class='line' style='background-color: #FFFFaa' onclick='toggleDiv("line43")'> 43:         self.pvl = len(self.pv) #length of propensity vector</pre>
<pre id='line43' class='code' style='background-color: #FFFFaa'>
    __pyx_t_4 = <span class='py_c_api'>PyObject_Length</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->pv);<span class='error_goto'> if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->pvl = __pyx_t_4;
</pre><pre class='line' style='background-color: #FFFFaa' onclick='toggleDiv("line44")'> 44:         self.nvars = len(self.inits) #number of variables</pre>
<pre id='line44' class='code' style='background-color: #FFFFaa'>
    __pyx_t_4 = <span class='py_c_api'>PyObject_Length</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->inits);<span class='error_goto'> if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->nvars = __pyx_t_4;
</pre><pre class='line' style='background-color: #FFFF48' onclick='toggleDiv("line45")'> 45:         self.time = np.zeros(1)</pre>
<pre id='line45' class='code' style='background-color: #FFFF48'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_3 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__zeros);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_int_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
  __pyx_t_2 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_3, __pyx_t_1, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_2, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time));
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFF48' onclick='toggleDiv("line46")'> 46:         self.series = np.zeros(1)</pre>
<pre id='line46' class='code' style='background-color: #FFFF48'>
    __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_2, __pyx_n_s__zeros);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_int_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
  __pyx_t_3 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_1, __pyx_t_2, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_3, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->series);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->series));
  ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->series = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
</pre><pre class='line' style='background-color: #FFFF9f' onclick='toggleDiv("line47")'> 47:         self.steps = 0</pre>
<pre id='line47' class='code' style='background-color: #FFFF9f'>
    ((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->steps = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.Model.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line48")'> 48: </pre>
<pre id='line48' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF13' onclick='toggleDiv("line49")'> 49:     cpdef run(self, method='SSA', int tmax=10, int reps=1):</pre>
<pre id='line49' class='code' style='background-color: #FFFF13'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); struct __pyx_opt_args_5trunk_3BIP_3SDE_10cgillespie_5Model_run {
  int __pyx_n;
  PyObject *method;
  int tmax;
  int reps;
};
</pre><pre class='line' style='background-color: #FFFF20' onclick='toggleDiv("line50")'> 50:         cdef np.ndarray[np.int_t,ndim=3] res = np.zeros((tmax,self.nvars,reps),dtype=np.int)</pre>
<pre id='line50' class='code' style='background-color: #FFFF20'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_3 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__zeros);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyInt_FromLong</span>(__pyx_v_tmax);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_4 = <span class='py_c_api'>PyLong_FromUnsignedLong</span>(__pyx_v_self->nvars);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_2 = <span class='py_c_api'>PyInt_FromLong</span>(__pyx_v_reps);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_t_5 = <span class='py_c_api'>PyTuple_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_5, 0, __pyx_t_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_1);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_5, 1, __pyx_t_4);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_4);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_5, 2, __pyx_t_2);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_5);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_5));
  __pyx_t_4 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_4, __pyx_n_s__int);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_5));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_1, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_res, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {
      __pyx_v_res = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_res.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_res = __pyx_bstruct_res.strides[0]; __pyx_bstride_1_res = __pyx_bstruct_res.strides[1]; __pyx_bstride_2_res = __pyx_bstruct_res.strides[2];
      __pyx_bshape_0_res = __pyx_bstruct_res.shape[0]; __pyx_bshape_1_res = __pyx_bstruct_res.shape[1]; __pyx_bshape_2_res = __pyx_bstruct_res.shape[2];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_res = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
</pre><pre class='line' style='background-color: #FFFF29' onclick='toggleDiv("line51")'> 51:         cdef np.ndarray[np.int_t] tvec = np.arange(tmax,dtype=np.int)</pre>
<pre id='line51' class='code' style='background-color: #FFFF29'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_5 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__arange);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyInt_FromLong</span>(__pyx_v_tmax);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_4 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_3, __pyx_n_s__int);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_5, __pyx_t_2, ((PyObject *)__pyx_t_1));<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_4, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_tvec, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_tvec = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_tvec.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_tvec = __pyx_bstruct_tvec.strides[0];
      __pyx_bshape_0_tvec = __pyx_bstruct_tvec.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_tvec = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
</pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line52")'> 52:         self.res = res</pre>
<pre id='line52' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_res));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_v_res));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_v_self->res);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_v_self->res));
  __pyx_v_self->res = ((PyArrayObject *)__pyx_v_res);
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line53")'> 53:         cdef int i, steps</pre>
<pre id='line53' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF79' onclick='toggleDiv("line54")'> 54:         if method =='SSA':</pre>
<pre id='line54' class='code' style='background-color: #FFFF79'>
    __pyx_t_4 = <span class='py_c_api'>PyObject_RichCompare</span>(__pyx_v_method, ((PyObject *)__pyx_n_s__SSA), Py_EQ);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_8 = __Pyx_<span class='py_c_api'>PyObject_IsTrue</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line55")'> 55:             for i from 0 &lt;= i&lt;reps:</pre>
<pre id='line55' class='code' style='background-color: #FFFFff'>
        __pyx_t_9 = __pyx_v_reps;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {
</pre><pre class='line' style='background-color: #FFFFaa' onclick='toggleDiv("line56")'> 56:                 steps = self.GSSA(tmax,i)</pre>
<pre id='line56' class='code' style='background-color: #FFFFaa'>
            __pyx_t_11.__pyx_n = 2;
      __pyx_t_11.tmax = __pyx_v_tmax;
      __pyx_t_11.round = __pyx_v_i;
      __pyx_t_10 = ((struct __pyx_vtabstruct_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self->__pyx_vtab)->GSSA(__pyx_v_self, &__pyx_t_11);<span class='error_goto'> if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      __pyx_v_steps = __pyx_t_10;
    }
    goto __pyx_L3;
  }
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line57")'> 57:             #print steps,' steps'</pre>
<pre id='line57' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF79' onclick='toggleDiv("line58")'> 58:         elif method == 'SSAct':</pre>
<pre id='line58' class='code' style='background-color: #FFFF79'>
    __pyx_t_4 = <span class='py_c_api'>PyObject_RichCompare</span>(__pyx_v_method, ((PyObject *)__pyx_n_s__SSAct), Py_EQ);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_8 = __Pyx_<span class='py_c_api'>PyObject_IsTrue</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_8) {
    goto __pyx_L3;
  }
  __pyx_L3:;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line59")'> 59:             pass</pre>
<pre id='line59' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line60")'> 60:         self.time=tvec</pre>
<pre id='line60' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_tvec));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_v_tvec));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_v_self->time);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_v_self->time));
  __pyx_v_self->time = ((PyArrayObject *)__pyx_v_tvec);
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line61")'> 61:        # self.series=self.res</pre>
<pre id='line61' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF48' onclick='toggleDiv("line62")'> 62:         self.steps=steps</pre>
<pre id='line62' class='code' style='background-color: #FFFF48'>
    __pyx_v_self->steps = __pyx_v_steps;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_type, &__pyx_value, &__pyx_tb);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_res);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_tvec);
  <span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_type, __pyx_value, __pyx_tb);}
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.Model.run");
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_res);
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_tvec);
  __pyx_L2:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_res);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_tvec);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>((PyObject *)__pyx_v_self);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_method);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line63")'> 63: </pre>
<pre id='line63' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFe7' onclick='toggleDiv("line64")'> 64:     def getStats(self):</pre>
<pre id='line64' class='code' style='background-color: #FFFFe7'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_getStats(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_getStats(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("getStats");
</pre><pre class='line' style='background-color: #FFFF4f' onclick='toggleDiv("line65")'> 65:         return self.time,self.res,self.steps</pre>
<pre id='line65' class='code' style='background-color: #FFFF4f'>
    <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_1 = <span class='py_c_api'>PyLong_FromUnsignedLong</span>(((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->steps);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time));
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->time));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->res));
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 1, ((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->res));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)((struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *)__pyx_v_self)->res));
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 2, __pyx_t_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.Model.getStats");
  __pyx_r = NULL;
  __pyx_L0:;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line66")'> 66: </pre>
<pre id='line66' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF9f' onclick='toggleDiv("line67")'> 67:     cdef int GSSA(self, unsigned int tmax=50, unsigned int round=0) except *:</pre>
<pre id='line67' class='code' style='background-color: #FFFF9f'>
static  int __pyx_f_5trunk_3BIP_3SDE_10cgillespie_5Model_GSSA(struct __pyx_obj_5trunk_3BIP_3SDE_10cgillespie_Model *__pyx_v_self, struct __pyx_opt_args_5trunk_3BIP_3SDE_10cgillespie_5Model_GSSA *__pyx_optional_args) {
  unsigned int __pyx_v_tmax = ((unsigned int)50);
  unsigned int __pyx_v_round = ((unsigned int)0);
  PyArrayObject *__pyx_v_ini = 0;
  PyArrayObject *__pyx_v_r = 0;
  PyObject *__pyx_v_pvi;
  int __pyx_v_l;
  int __pyx_v_steps;
  int __pyx_v_i;
  int __pyx_v_tim;
  double __pyx_v_tc;
  double __pyx_v_tau;
  double __pyx_v_a0;
  PyArrayObject *__pyx_v_pv;
  PyObject *__pyx_v_tm;
  PyObject *__pyx_v_event;
  Py_buffer __pyx_bstruct_pv;
  Py_ssize_t __pyx_bstride_0_pv = 0;
  Py_ssize_t __pyx_bshape_0_pv = 0;
  Py_buffer __pyx_bstruct_r;
  Py_ssize_t __pyx_bstride_0_r = 0;
  Py_ssize_t __pyx_bshape_0_r = 0;
  Py_buffer __pyx_bstruct_ini;
  Py_ssize_t __pyx_bstride_0_ini = 0;
  Py_ssize_t __pyx_bshape_0_ini = 0;
  int __pyx_r;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("GSSA");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_tmax = __pyx_optional_args->tmax;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_round = __pyx_optional_args->round;
      }
    }
  }
  <span class='pyx_macro_api'>__Pyx_INCREF</span>((PyObject *)__pyx_v_self);
  __pyx_v_pvi = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  __pyx_v_pv = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  __pyx_v_tm = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  __pyx_v_event = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  __pyx_bstruct_ini.buf = NULL;
  __pyx_bstruct_r.buf = NULL;
  __pyx_bstruct_pv.buf = NULL;

struct __pyx_opt_args_5trunk_3BIP_3SDE_10cgillespie_5Model_GSSA {
  int __pyx_n;
  unsigned int tmax;
  unsigned int round;
};
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line68")'> 68:         '''</pre>
<pre id='line68' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line69")'> 69:         Gillespie Direct algorithm</pre>
<pre id='line69' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line70")'> 70:         '''</pre>
<pre id='line70' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF44' onclick='toggleDiv("line71")'> 71:         cdef np.ndarray[np.int_t] ini = np.array(self.inits)</pre>
<pre id='line71' class='code' style='background-color: #FFFF44'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__array);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_self->inits);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_self->inits);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_v_self->inits);
  __pyx_t_3 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_2, __pyx_t_1, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_3, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_4 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_ini, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_ini = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_ini.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_ini = __pyx_bstruct_ini.strides[0];
      __pyx_bshape_0_ini = __pyx_bstruct_ini.shape[0];
    }
  }
  __pyx_t_4 = 0;
  __pyx_v_ini = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
</pre><pre class='line' style='background-color: #FFFFb6' onclick='toggleDiv("line72")'> 72:         cdef np.ndarray[np.double_t] r = self.rates</pre>
<pre id='line72' class='code' style='background-color: #FFFFb6'>
    __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->rates);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_r, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_r = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_r.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_r = __pyx_bstruct_r.strides[0];
      __pyx_bshape_0_r = __pyx_bstruct_r.shape[0];
    }
  }
  __pyx_t_5 = 0;
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_self->rates));
  __pyx_v_r = ((PyArrayObject *)__pyx_v_self->rates);
</pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line73")'> 73:         pvi = self.pv</pre>
<pre id='line73' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_self->pv);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_pvi);
  __pyx_v_pvi = __pyx_v_self->pv;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line74")'> 74:         cdef int l,steps,i,tim</pre>
<pre id='line74' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line75")'> 75:         cdef double tc, tau, a0</pre>
<pre id='line75' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line76")'> 76:         #cdef np.ndarray[INT_t] tvec</pre>
<pre id='line76' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line77")'> 77:         cdef np.ndarray[np.double_t] pv</pre>
<pre id='line77' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line78")'> 78:         l=self.pvl</pre>
<pre id='line78' class='code' style='background-color: #FFFFff'>
    __pyx_v_l = __pyx_v_self->pvl;
</pre><pre class='line' style='background-color: #FFFF21' onclick='toggleDiv("line79")'> 79:         pv = np.zeros(l,dtype=np.double)</pre>
<pre id='line79' class='code' style='background-color: #FFFF21'>
    __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_3, __pyx_n_s__zeros);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = <span class='py_c_api'>PyInt_FromLong</span>(__pyx_v_l);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_3);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_3));
  __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_6);
  __pyx_t_7 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_6, __pyx_n_s__double);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3));<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_7, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_pv);
    __pyx_t_9 = <span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_pv, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_9 < 0)) {
      <span class='py_c_api'>PyErr_Fetch</span>(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_pv, (PyObject*)__pyx_v_pv, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
        <span class='pyx_c_api'>__Pyx_RaiseBufferFallbackError</span>();
      } else {
        <span class='py_c_api'>PyErr_Restore</span>(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
    }
    __pyx_bstride_0_pv = __pyx_bstruct_pv.strides[0];
    __pyx_bshape_0_pv = __pyx_bstruct_pv.shape[0];
    if (unlikely(__pyx_t_9 < 0))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  }
  __pyx_t_8 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_v_pv));
  __pyx_v_pv = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;
</pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line80")'> 80:         tm = self.tm</pre>
<pre id='line80' class='code' style='background-color: #FFFFd4'>
    <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_self->tm));
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_tm);
  __pyx_v_tm = ((PyObject *)__pyx_v_self->tm);
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line81")'> 81:         #tvec = np.arange(tmax,dtype=int)</pre>
<pre id='line81' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line82")'> 82:         tc = 0</pre>
<pre id='line82' class='code' style='background-color: #FFFFff'>
    __pyx_v_tc = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line83")'> 83:         steps = 0</pre>
<pre id='line83' class='code' style='background-color: #FFFFff'>
    __pyx_v_steps = 0;
</pre><pre class='line' style='background-color: #FFFF48' onclick='toggleDiv("line84")'> 84:         self.res[0,:,round]= ini</pre>
<pre id='line84' class='code' style='background-color: #FFFF48'>
    __pyx_t_7 = <span class='py_c_api'>PySlice_New</span>(Py_None, Py_None, Py_None);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
  __pyx_t_3 = <span class='py_c_api'>PyLong_FromUnsignedLong</span>(__pyx_v_round);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_int_0);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_0);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 1, __pyx_t_7);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_7);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 2, __pyx_t_3);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
  __pyx_t_7 = 0;
  __pyx_t_3 = 0;
  if (<span class='py_c_api'>PyObject_SetItem</span>(((PyObject *)__pyx_v_self->res), __pyx_t_2, ((PyObject *)__pyx_v_ini)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line85")'> 85:         a0=1.</pre>
<pre id='line85' class='code' style='background-color: #FFFFff'>
    __pyx_v_a0 = 1.0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line86")'> 86:         for tim from 1&lt;= tim &lt;tmax:</pre>
<pre id='line86' class='code' style='background-color: #FFFFff'>
    __pyx_t_13 = __pyx_v_tmax;
  for (__pyx_v_tim = 1; __pyx_v_tim < __pyx_t_13; __pyx_v_tim++) {
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line87")'> 87:             while tc &lt; tim:</pre>
<pre id='line87' class='code' style='background-color: #FFFFff'>
        while (1) {
      __pyx_t_14 = (__pyx_v_tc < __pyx_v_tim);
      if (!__pyx_t_14) break;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line88")'> 88:                 for i from 0 &lt;= i &lt;l:</pre>
<pre id='line88' class='code' style='background-color: #FFFFff'>
            __pyx_t_9 = __pyx_v_l;
      for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {
</pre><pre class='line' style='background-color: #FFFF3e' onclick='toggleDiv("line89")'> 89:                     pv[i] = pvi[i](r,ini)</pre>
<pre id='line89' class='code' style='background-color: #FFFF3e'>
                __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(__pyx_v_pvi, __pyx_v_i, sizeof(int), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
        __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_r));
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, ((PyObject *)__pyx_v_r));
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_v_r));
        <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_ini));
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 1, ((PyObject *)__pyx_v_ini));
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_v_ini));
        __pyx_t_7 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_2, __pyx_t_3, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_15 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_7);<span class='error_goto'> if (unlikely((__pyx_t_15 == (npy_double)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_16 = __pyx_v_i;
        __pyx_t_17 = -1;
        if (__pyx_t_16 < 0) {
          __pyx_t_16 += __pyx_bshape_0_pv;
          if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
        } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_pv)) __pyx_t_17 = 0;
        if (unlikely(__pyx_t_17 != -1)) {
          <span class='pyx_c_api'>__Pyx_RaiseBufferIndexError</span>(__pyx_t_17);
         <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        }
        *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_double_t *, __pyx_bstruct_pv.buf, __pyx_t_16, __pyx_bstride_0_pv) = __pyx_t_15;
      }
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line90")'> 90:                 #pv = abs(array([eq() for eq in pvi]))# #propensity vector</pre>
<pre id='line90' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line91")'> 91:                 a0 = a_sum(pv,l) #sum of all transition probabilities</pre>
<pre id='line91' class='code' style='background-color: #FFFFff'>
            __pyx_v_a0 = __pyx_f_5trunk_3BIP_3SDE_10cgillespie_a_sum(((PyArrayObject *)__pyx_v_pv), __pyx_v_l);
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line92")'> 92:                 #print ini#,tim, pv, a0</pre>
<pre id='line92' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF62' onclick='toggleDiv("line93")'> 93:                 tau = (-1/a0)*clog(crandom())</pre>
<pre id='line93' class='code' style='background-color: #FFFF62'>
            if (unlikely(__pyx_v_a0 == 0)) {
        <span class='py_c_api'>PyErr_Format</span>(PyExc_ZeroDivisionError, "float division");
       <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      }
      __pyx_t_7 = __pyx_f_5trunk_3BIP_3SDE_10cgillespie_crandom();<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
      __pyx_t_18 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_7);<span class='error_goto'> if (unlikely((__pyx_t_18 == (double)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_tau = ((-1 / __pyx_v_a0) * __pyx_f_5trunk_3BIP_3SDE_10cgillespie_clog(__pyx_t_18));
</pre><pre class='line' style='background-color: #FFFF5e' onclick='toggleDiv("line94")'> 94:                 if pv.any():</pre>
<pre id='line94' class='code' style='background-color: #FFFF5e'>
            __pyx_t_7 = <span class='py_c_api'>PyObject_GetAttr</span>(((PyObject *)__pyx_v_pv), __pyx_n_s__any);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
      __pyx_t_3 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_14 = __Pyx_<span class='py_c_api'>PyObject_IsTrue</span>(__pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
      <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_14) {
</pre><pre class='line' style='background-color: #FFFF32' onclick='toggleDiv("line95")'> 95:                     event = np.random.multinomial(1,(pv/a0)) # event which will happen on this iteration</pre>
<pre id='line95' class='code' style='background-color: #FFFF32'>
                __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        __pyx_t_7 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_3, __pyx_n_s__random);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_7, __pyx_n_s__multinomial);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_v_a0);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        __pyx_t_2 = __Pyx_<span class='py_c_api'>PyNumber_Divide</span>(((PyObject *)__pyx_v_pv), __pyx_t_7);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_7, 0, __pyx_int_1);
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_7, 1, __pyx_t_2);
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_3, __pyx_t_7, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_event);
        __pyx_v_event = __pyx_t_2;
        __pyx_t_2 = 0;
</pre><pre class='line' style='background-color: #FFFF23' onclick='toggleDiv("line96")'> 96:                     ini += tm[:,event.nonzero()[0][0]]</pre>
<pre id='line96' class='code' style='background-color: #FFFF23'>
                __pyx_t_2 = <span class='py_c_api'>PySlice_New</span>(Py_None, Py_None, Py_None);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
        __pyx_t_7 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_v_event, __pyx_n_s__nonzero);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        __pyx_t_3 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(__pyx_t_3, 0, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(__pyx_t_7, 0, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_7, 0, __pyx_t_2);
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_2);
        <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_7, 1, __pyx_t_3);
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
        __pyx_t_2 = 0;
        __pyx_t_3 = 0;
        __pyx_t_3 = <span class='py_c_api'>PyObject_GetItem</span>(__pyx_v_tm, __pyx_t_7);<span class='error_goto'> if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = <span class='py_c_api'>PyNumber_InPlaceAdd</span>(((PyObject *)__pyx_v_ini), __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
        if (!(likely(((__pyx_t_7) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_7, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_4 = ((PyArrayObject *)__pyx_t_7);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_ini);
          __pyx_t_9 = <span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_ini, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_9 < 0)) {
            <span class='py_c_api'>PyErr_Fetch</span>(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
            if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_ini, (PyObject*)__pyx_v_ini, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10);
              <span class='pyx_c_api'>__Pyx_RaiseBufferFallbackError</span>();
            } else {
              <span class='py_c_api'>PyErr_Restore</span>(__pyx_t_12, __pyx_t_11, __pyx_t_10);
            }
          }
          __pyx_bstride_0_ini = __pyx_bstruct_ini.strides[0];
          __pyx_bshape_0_ini = __pyx_bstruct_ini.shape[0];
          if (unlikely(__pyx_t_9 < 0))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
        }
        __pyx_t_4 = 0;
        <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_v_ini));
        __pyx_v_ini = ((PyArrayObject *)__pyx_t_7);
        __pyx_t_7 = 0;
        goto __pyx_L9;
      }
      __pyx_L9:;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line97")'> 97:                 #print tc, ini</pre>
<pre id='line97' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line98")'> 98:                 tc += tau</pre>
<pre id='line98' class='code' style='background-color: #FFFFff'>
            __pyx_v_tc += __pyx_v_tau;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line99")'> 99:                 steps +=1</pre>
<pre id='line99' class='code' style='background-color: #FFFFff'>
            __pyx_v_steps += 1;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line100")'> 100:                 if a0 == 0: break</pre>
<pre id='line100' class='code' style='background-color: #FFFFff'>
            __pyx_t_14 = (__pyx_v_a0 == 0);
      if (__pyx_t_14) {
        goto __pyx_L6_break;
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __pyx_L6_break:;
</pre><pre class='line' style='background-color: #FFFF41' onclick='toggleDiv("line101")'> 101:             self.res[tim,:,round] = ini</pre>
<pre id='line101' class='code' style='background-color: #FFFF41'>
        __pyx_t_7 = <span class='py_c_api'>PyInt_FromLong</span>(__pyx_v_tim);<span class='error_goto'> if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_7);
    __pyx_t_3 = <span class='py_c_api'>PySlice_New</span>(Py_None, Py_None, Py_None);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
    __pyx_t_2 = <span class='py_c_api'>PyLong_FromUnsignedLong</span>(__pyx_v_round);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
    __pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
    <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_t_7);
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_7);
    <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 1, __pyx_t_3);
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
    <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 2, __pyx_t_2);
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_2);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    if (<span class='py_c_api'>PyObject_SetItem</span>(((PyObject *)__pyx_v_self->res), __pyx_t_1, ((PyObject *)__pyx_v_ini)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  }
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line102")'> 102:             #if a0 == 0: break</pre>
<pre id='line102' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line103")'> 103: #        tvec = tvec[:tim]</pre>
<pre id='line103' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line104")'> 104: #        self.res = res[:tim,:,round]</pre>
<pre id='line104' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF3e' onclick='toggleDiv("line105")'> 105:         return steps</pre>
<pre id='line105' class='code' style='background-color: #FFFF3e'>
    __pyx_r = __pyx_v_steps;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_type, &__pyx_value, &__pyx_tb);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_pv);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_r);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_ini);
  <span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_type, __pyx_value, __pyx_tb);}
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.Model.GSSA");
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_pv);
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_r);
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_ini);
  __pyx_L2:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_ini);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_r);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_pvi);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>((PyObject *)__pyx_v_pv);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_tm);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_event);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>((PyObject *)__pyx_v_self);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line106")'> 106: </pre>
<pre id='line106' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFc4' onclick='toggleDiv("line107")'> 107:     def CR(self,pv):</pre>
<pre id='line107' class='code' style='background-color: #FFFFc4'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_CR(PyObject *__pyx_v_self, PyObject *__pyx_v_pv); /*proto*/
static char __pyx_doc_5trunk_3BIP_3SDE_10cgillespie_5Model_CR[] = "\n        Composition reaction algorithm\n        ";
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_5Model_CR(PyObject *__pyx_v_self, PyObject *__pyx_v_pv) {
  PyObject *__pyx_r = NULL;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("CR");

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line108")'> 108:         """</pre>
<pre id='line108' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line109")'> 109:         Composition reaction algorithm</pre>
<pre id='line109' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line110")'> 110:         """</pre>
<pre id='line110' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line111")'> 111:         pass</pre>
<pre id='line111' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line112")'> 112: </pre>
<pre id='line112' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF2b' onclick='toggleDiv("line113")'> 113: cpdef double l1(np.ndarray r,np.ndarray ini):</pre>
<pre id='line113' class='code' style='background-color: #FFFF2b'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_ini = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__r,&__pyx_n_s__ini,0};
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("l1");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);
      case  1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  0:
      values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__r);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__ini);
      if (likely(values[1])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("l1", 1, 2, 2, 1);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args), "l1") < 0))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
    }
    __pyx_v_r = ((PyArrayObject *)values[0]);
    __pyx_v_ini = ((PyArrayObject *)values[1]);
  } else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_r = ((PyArrayObject *)<span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0));
    __pyx_v_ini = ((PyArrayObject *)<span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("l1", 1, 2, 2, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args));<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
  __pyx_L3_error:;
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.l1");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_r), __pyx_ptype_5numpy_ndarray, 1, "r", 0)))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_ini), __pyx_ptype_5numpy_ndarray, 1, "ini", 0)))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5trunk_3BIP_3SDE_10cgillespie_l1(__pyx_v_r, __pyx_v_ini, 0));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.l1");
  __pyx_r = NULL;
  __pyx_L0:;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFF36' onclick='toggleDiv("line114")'> 114:     return r[0]*ini[0]*ini[1]</pre>
<pre id='line114' class='code' style='background-color: #FFFF36'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_r), 0, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_ini), 0, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_t_3 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_1, __pyx_t_2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_ini), 1, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_t_1 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_3, __pyx_t_2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_1);<span class='error_goto'> if (unlikely((__pyx_t_4 == (double)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("trunk.BIP.SDE.cgillespie.l1");
  __pyx_r = 0;
  __pyx_L0:;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFF2b' onclick='toggleDiv("line115")'> 115: cpdef double l2(np.ndarray r,np.ndarray ini):</pre>
<pre id='line115' class='code' style='background-color: #FFFF2b'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_l2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_r = 0;
  PyArrayObject *__pyx_v_ini = 0;
  PyObject *__pyx_r = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__r,&__pyx_n_s__ini,0};
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("l2");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);
      case  1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {
      case  0:
      values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__r);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s__ini);
      if (likely(values[1])) kw_args--;
      else {
        <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("l2", 1, 2, 2, 1);<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args), "l2") < 0))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
    }
    __pyx_v_r = ((PyArrayObject *)values[0]);
    __pyx_v_ini = ((PyArrayObject *)values[1]);
  } else if (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_r = ((PyArrayObject *)<span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0));
    __pyx_v_ini = ((PyArrayObject *)<span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("l2", 1, 2, 2, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args));<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;}</span>
  __pyx_L3_error:;
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.l2");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_r), __pyx_ptype_5numpy_ndarray, 1, "r", 0)))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_ini), __pyx_ptype_5numpy_ndarray, 1, "ini", 0)))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_1 = <span class='py_c_api'>PyFloat_FromDouble</span>(__pyx_f_5trunk_3BIP_3SDE_10cgillespie_l2(__pyx_v_r, __pyx_v_ini, 0));<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.l2");
  __pyx_r = NULL;
  __pyx_L0:;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFF43' onclick='toggleDiv("line116")'> 116:     return r[1]*ini[1]</pre>
<pre id='line116' class='code' style='background-color: #FFFF43'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_r), 1, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_ini), 1, sizeof(long), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  __pyx_t_3 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_1, __pyx_t_2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_3);<span class='error_goto'> if (unlikely((__pyx_t_4 == (double)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("trunk.BIP.SDE.cgillespie.l2");
  __pyx_r = 0;
  __pyx_L0:;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line117")'> 117: </pre>
<pre id='line117' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFF73' onclick='toggleDiv("line118")'> 118: cpdef main():</pre>
<pre id='line118' class='code' style='background-color: #FFFF73'>
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_main(PyObject *__pyx_self, PyObject *unused); static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_main(PyObject *__pyx_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5trunk_3BIP_3SDE_10cgillespie_main(PyObject *__pyx_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("main");
  __pyx_self = __pyx_self;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_1 = __pyx_f_5trunk_3BIP_3SDE_10cgillespie_main(0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.main");
  __pyx_r = NULL;
  __pyx_L0:;
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFF73' onclick='toggleDiv("line119")'> 119:     vars = ['s','i','r']</pre>
<pre id='line119' class='code' style='background-color: #FFFF73'>
    __pyx_t_1 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__s));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__s));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__s));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__i));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__i));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__i));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_n_s__r));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__r));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_n_s__r));
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_vars);
  __pyx_v_vars = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
</pre><pre class='line' style='background-color: #FFFF26' onclick='toggleDiv("line120")'> 120:     cdef np.ndarray[np.int_t] ini= np.array([500,1,0],dtype = np.int)</pre>
<pre id='line120' class='code' style='background-color: #FFFF26'>
    __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_1, __pyx_n_s__array);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_500);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 0, __pyx_int_500);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_500);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 1, __pyx_int_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 2, __pyx_int_0);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_0);
  __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  __pyx_t_4 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_5 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_4, __pyx_n_s__int);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_t_1));<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_5, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_ini, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_ini = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_ini.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_ini = __pyx_bstruct_ini.strides[0];
      __pyx_bshape_0_ini = __pyx_bstruct_ini.shape[0];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_ini = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
</pre><pre class='line' style='background-color: #FFFF22' onclick='toggleDiv("line121")'> 121:     cdef np.ndarray[np.float64_t] rates = np.array([.001,.1],dtype=np.float64)</pre>
<pre id='line121' class='code' style='background-color: #FFFF22'>
    __pyx_t_5 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_5, __pyx_n_s__array);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = <span class='py_c_api'>PyFloat_FromDouble</span>(0.001);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_3 = <span class='py_c_api'>PyFloat_FromDouble</span>(0.10000000000000001);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_2));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_5);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_5);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_2, 1, __pyx_t_3);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_3);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_2));
  __pyx_t_2 = 0;
  __pyx_t_2 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_2));
  __pyx_t_5 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_4 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_5, __pyx_n_s__float64);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2));<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_4, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_rates, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_rates = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_rates.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_rates = __pyx_bstruct_rates.strides[0];
      __pyx_bshape_0_rates = __pyx_bstruct_rates.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_rates = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
</pre><pre class='line' style='background-color: #FFFF1c' onclick='toggleDiv("line122")'> 122:     cdef np.ndarray[np.int_t,ndim=2] tm = np.array([[-1,0],[1,-1],[0,1]],dtype=np.int)</pre>
<pre id='line122' class='code' style='background-color: #FFFF1c'>
    __pyx_t_4 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_2 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_4, __pyx_n_s__array);<span class='error_goto'> if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_4));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_neg_1);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_4, 0, __pyx_int_neg_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_neg_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_4, 1, __pyx_int_0);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_0);
  __pyx_t_3 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_3));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_int_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_neg_1);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_3, 1, __pyx_int_neg_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_neg_1);
  __pyx_t_1 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_0);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 0, __pyx_int_0);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_0);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_int_1);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 1, __pyx_int_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_int_1);
  __pyx_t_5 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_5));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_5, 0, ((PyObject *)__pyx_t_4));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_4));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_5, 1, ((PyObject *)__pyx_t_3));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_3));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_5, 2, ((PyObject *)__pyx_t_1));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_1));
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_t_5));
  __pyx_t_5 = 0;
  __pyx_t_5 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_5));
  __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__np);<span class='error_goto'> if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_3);
  __pyx_t_4 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_3, __pyx_n_s__int);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_5));<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_4, __pyx_ptype_5numpy_ndarray)))))<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_bstruct_tm, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_tm = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_bstruct_tm.buf = NULL;
     <span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    } else {__pyx_bstride_0_tm = __pyx_bstruct_tm.strides[0]; __pyx_bstride_1_tm = __pyx_bstruct_tm.strides[1];
      __pyx_bshape_0_tm = __pyx_bstruct_tm.shape[0]; __pyx_bshape_1_tm = __pyx_bstruct_tm.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_tm = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
</pre><pre class='line' style='background-color: #FFFF73' onclick='toggleDiv("line123")'> 123:     prop = [l1,l2]</pre>
<pre id='line123' class='code' style='background-color: #FFFF73'>
    __pyx_t_4 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__l1);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_5 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__l2);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_1 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 0, __pyx_t_4);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_4);
  <span class='py_macro_api'>PyList_SET_ITEM</span>(__pyx_t_1, 1, __pyx_t_5);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_5);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_prop);
  __pyx_v_prop = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
</pre><pre class='line' style='background-color: #FFFF36' onclick='toggleDiv("line124")'> 124:     M = Model(vnames = vars,rates = rates,inits=ini, tmat=tm,propensity=prop)</pre>
<pre id='line124' class='code' style='background-color: #FFFF36'>
    __pyx_t_1 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__vnames), __pyx_v_vars) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__rates), ((PyObject *)__pyx_v_rates)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__inits), ((PyObject *)__pyx_v_ini)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__tmat), ((PyObject *)__pyx_v_tm)) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__propensity), __pyx_v_prop) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_5 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(((PyObject *)((PyObject*)__pyx_ptype_5trunk_3BIP_3SDE_10cgillespie_Model)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1));<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_M);
  __pyx_v_M = __pyx_t_5;
  __pyx_t_5 = 0;
</pre><pre class='line' style='background-color: #FFFF66' onclick='toggleDiv("line125")'> 125:     t0=time.time()</pre>
<pre id='line125' class='code' style='background-color: #FFFF66'>
    __pyx_t_5 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__time);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_5, __pyx_n_s__time);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_t0);
  __pyx_v_t0 = __pyx_t_5;
  __pyx_t_5 = 0;
</pre><pre class='line' style='background-color: #FFFF43' onclick='toggleDiv("line126")'> 126:     M.run(tmax=80,reps=1000)</pre>
<pre id='line126' class='code' style='background-color: #FFFF43'>
    __pyx_t_5 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_v_M, __pyx_n_s__run);<span class='error_goto'> if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_5);
  __pyx_t_1 = <span class='py_c_api'>PyDict_New</span>();<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(((PyObject *)__pyx_t_1));
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__tmax), __pyx_int_80) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, ((PyObject *)__pyx_n_s__reps), __pyx_int_1000) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  __pyx_t_4 = <span class='py_c_api'>PyEval_CallObjectWithKeywords</span>(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1));<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
</pre><pre class='line' style='background-color: #FFFF3e' onclick='toggleDiv("line127")'> 127:     print 'total time: ',time.time()-t0</pre>
<pre id='line127' class='code' style='background-color: #FFFF3e'>
    __pyx_t_4 = <span class='pyx_c_api'>__Pyx_GetName</span>(__pyx_m, __pyx_n_s__time);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_t_4, __pyx_n_s__time);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = <span class='py_c_api'>PyNumber_Subtract</span>(__pyx_t_4, __pyx_v_t0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = <span class='py_c_api'>PyTuple_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_kp_s_1));
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_1));
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(((PyObject *)__pyx_kp_s_1));
  <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_4, 1, __pyx_t_1);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GIVEREF</span></span>(__pyx_t_1);
  __pyx_t_1 = 0;
  if (<span class='pyx_c_api'>__Pyx_Print</span>(__pyx_t_4, 1) < 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
</pre><pre class='line' style='background-color: #FFFF2f' onclick='toggleDiv("line128")'> 128:     return M.getStats()</pre>
<pre id='line128' class='code' style='background-color: #FFFF2f'>
    <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
  __pyx_t_4 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_v_M, __pyx_n_s__getStats);<span class='error_goto'> if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_4);
  __pyx_t_1 = <span class='py_c_api'>PyObject_Call</span>(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_type, &__pyx_value, &__pyx_tb);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_tm);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_rates);
    <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_ini);
  <span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_type, __pyx_value, __pyx_tb);}
  <span class='pyx_c_api'>__Pyx_AddTraceback</span>("trunk.BIP.SDE.cgillespie.main");
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_tm);
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_rates);
  <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_bstruct_ini);
  __pyx_L2:;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_vars);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_ini);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_rates);
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_tm);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_prop);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_M);
  <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_t0);
  <span class='pyx_macro_api'><span class='refnanny'>__Pyx_XGIVEREF</span></span>(__pyx_r);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line129")'> 129: </pre>
<pre id='line129' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line130")'> 130: </pre>
<pre id='line130' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFd4' onclick='toggleDiv("line131")'> 131: cdef double a_sum(np.ndarray a, unsigned int len):</pre>
<pre id='line131' class='code' style='background-color: #FFFFd4'>
static  double __pyx_f_5trunk_3BIP_3SDE_10cgillespie_a_sum(PyArrayObject *__pyx_v_a, unsigned int __pyx_v_len) {
  double __pyx_v_s;
  int __pyx_v_i;
  double __pyx_r;
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannySetupContext</span></span>("a_sum");
  <span class='pyx_macro_api'>__Pyx_INCREF</span>((PyObject *)__pyx_v_a);
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line132")'> 132:     cdef double s</pre>
<pre id='line132' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line133")'> 133:     cdef int i</pre>
<pre id='line133' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line134")'> 134:     s = 0</pre>
<pre id='line134' class='code' style='background-color: #FFFFff'>
    __pyx_v_s = 0;
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line135")'> 135:     for i from 0 &lt;= i &lt; len:</pre>
<pre id='line135' class='code' style='background-color: #FFFFff'>
    __pyx_t_1 = __pyx_v_len;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_1; __pyx_v_i++) {
</pre><pre class='line' style='background-color: #FFFF6e' onclick='toggleDiv("line136")'> 136:         s += a[i]</pre>
<pre id='line136' class='code' style='background-color: #FFFF6e'>
        __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetItemInt</span>(((PyObject *)__pyx_v_a), __pyx_v_i, sizeof(int), PyInt_FromLong);<span class='error_goto'> if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_2);
    __pyx_t_3 = __pyx_<span class='py_c_api'>PyFloat_AsDouble</span>(__pyx_t_2);<span class='error_goto'> if (unlikely((__pyx_t_3 == (double)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
    <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_s += __pyx_t_3;
  }
</pre><pre class='line' style='background-color: #FFFFaa' onclick='toggleDiv("line137")'> 137:     return s</pre>
<pre id='line137' class='code' style='background-color: #FFFFaa'>
    __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
  <span class='pyx_c_api'>__Pyx_WriteUnraisable</span>("trunk.BIP.SDE.cgillespie.a_sum");
  __pyx_r = 0;
  __pyx_L0:;
  <span class='pyx_macro_api'>__Pyx_DECREF</span>((PyObject *)__pyx_v_a);
  <span class='pyx_c_api'><span class='refnanny'>__Pyx_RefNannyFinishContext</span></span>();
  return __pyx_r;
}
</pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line138")'> 138: </pre>
<pre id='line138' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line139")'> 139: </pre>
<pre id='line139' class='code' style='background-color: #FFFFff'></pre><pre class='line' style='background-color: #FFFFff' onclick='toggleDiv("line140")'> 140: </pre>
<pre id='line140' class='code' style='background-color: #FFFFff'></pre></body></html>
